
/**
 * 默认键值枚举
*/
export enum InputKeyCode {
    ENTER = 1,          // A
    D = (1 << 1),       // Y
    S = (1 << 2),       // X
    Back = (1 << 3),    // B
    Ctrl = (1 << 4),    // LB
    Shift = (1 << 5),   // RB
    ArrowL = (1 << 6),  // LT
    ArrowR = (1 << 7),  // RT
    Esc = (1 << 8),     // Menu
    Up = (1 << 9),      // 上
    Left = (1 << 10),   // 左
    Down = (1 << 11),   // 下
    Right = (1 << 12),   // 右
    M = (1 << 13),
    N = (1 << 14),
    B = (1 << 15),
    PERIOD = (1 << 16),
    COMMA = (1 << 17),
    Space = (1 << 18),

    MOUSE_LEFT = (1 << 20),          // left
    MOUSE_RIGHT = (1 << 21),       // right
    MOUSE_MIDDLE = (1 << 22),       // mid
    MOUSE_4 = (1 << 23),    // 4
    MOUSE_5 = (1 << 24),    // 5
    MOUSE_6 = (1 << 25),   // 6
    MOUSE_7 = (1 << 26),  // 7
    MOUSE_8 = (1 << 27),  // 8

    ROCKER_LEFT = (1 << 30),          // left
    ROCKER_RIGHT = (1 << 31),       // right
}

export class InputType {
    static CC = 'cc'
    static STEAM = 'steam'
    static SELF = 'self'
}

export let InputTypeTip = {
    cc: "cc_key",
    steam: 'steam_key'
}
/**
 * 按键对应的值
 */
export const SELF_KEY_CODE = {
    ENTER: InputKeyCode.ENTER,
    ESCAPE: InputKeyCode.Esc,
    PERIOD: InputKeyCode.PERIOD,
    COMMA: InputKeyCode.COMMA,
    D: InputKeyCode.D,
    S: InputKeyCode.S,
    BACKSPACE: InputKeyCode.Back,
    CTRL_LEFT: InputKeyCode.Ctrl,
    SHIFT_LEFT: InputKeyCode.Shift,
    M: InputKeyCode.M,
    N: InputKeyCode.N,
    B: InputKeyCode.B,
    Up: InputKeyCode.Up,
    Left: InputKeyCode.Left,
    Down: InputKeyCode.Down,
    Right: InputKeyCode.Right,
    RT: InputKeyCode.ArrowR,
    LT: InputKeyCode.ArrowL,
    MOUSE_LEFT: InputKeyCode.MOUSE_LEFT,
    MOUSE_RIGHT: InputKeyCode.MOUSE_RIGHT,
    MOUSE_MIDDLE: InputKeyCode.MOUSE_MIDDLE,
    MOUSE_4: InputKeyCode.MOUSE_4,
    MOUSE_5: InputKeyCode.MOUSE_5,
    MOUSE_6: InputKeyCode.MOUSE_6,
    MOUSE_7: InputKeyCode.MOUSE_7,
    MOUSE_8: InputKeyCode.MOUSE_8,
    ROCKER_LEFT: InputKeyCode.ROCKER_LEFT,
    ROCKER_RIGHT: InputKeyCode.ROCKER_RIGHT,
}

export type KeyMatchInfo = { self: string, cc: string[], steam: string[], cc_key?: string, steam_key?: string }

/**
 * 各个平台操作方式的映射表
 */
export let KeyCodeMatch: KeyMatchInfo[] = [
    { self: "ENTER", cc: ["ENTER"], steam: ["A"], cc_key: "", steam_key: "" },
    { self: "ESCAPE", cc: ["ESCAPE"], steam: ["Menu"], cc_key: "", steam_key: "" },
    { self: "PERIOD", cc: ["PERIOD"], steam: [], cc_key: "", steam_key: "" },
    { self: "COMMA", cc: ["COMMA"], steam: [], cc_key: "", steam_key: "" },
    { self: "D", cc: ["D"], steam: ["Y"], cc_key: "", steam_key: "" },
    { self: "S", cc: ["S"], steam: ["X"], cc_key: "", steam_key: "" },
    { self: "BACKSPACE", cc: ["BACKSPACE"], steam: ["B"], cc_key: "", steam_key: "" },
    { self: "CTRL_LEFT", cc: ["CTRL_LEFT"], steam: ["LB"], cc_key: "", steam_key: "" },
    { self: "SHIFT_LEFT", cc: ["SHIFT_LEFT"], steam: ["RB"], cc_key: "", steam_key: "" },
    { self: "M", cc: ["M"], steam: [], cc_key: "", steam_key: "" },
    { self: "N", cc: ["N"], steam: [], cc_key: "", steam_key: "" },
    { self: "B", cc: ["B"], steam: [], cc_key: "", steam_key: "" },
    { self: "Up", cc: ["Up"], steam: ["Up"], cc_key: "", steam_key: "" },
    { self: "Left", cc: ["Left"], steam: ["Left"], cc_key: "", steam_key: "" },
    { self: "Down", cc: ["Down"], steam: ["Down"], cc_key: "", steam_key: "" },
    { self: "Right", cc: ["Right"], steam: ["Right"], cc_key: "", steam_key: "" },
    { self: "LT", cc: [], steam: ["LT"], cc_key: "", steam_key: "" },
    { self: "RT", cc: [], steam: ["RT"], cc_key: "", steam_key: "" },
    { self: "MOUSE_LEFT", cc: ["MOUSE_LEFT"], steam: [] },
    { self: "MOUSE_RIGHT", cc: ["MOUSE_RIGHT"], steam: [] },
    { self: "MOUSE_MIDDLE", cc: ["MOUSE_MIDDLE"], steam: [] },
    { self: "MOUSE_4", cc: ["MOUSE_4"], steam: [] },
    { self: "MOUSE_5", cc: ["MOUSE_5"], steam: [] },
    { self: "MOUSE_6", cc: ["MOUSE_6"], steam: [] },
    { self: "MOUSE_7", cc: ["MOUSE_7"], steam: [] },
    { self: "MOUSE_8", cc: ["MOUSE_8"], steam: [] },
    { self: "ROCKER_LEFT", cc: [], steam: ["ROCKER_LEFT"] },
    { self: "ROCKER_RIGHT", cc: [], steam: ["ROCKER_RIGHT"] },
]

export type ConfigInfo = { name: string, keycode: string, function: string, button: string, group: number };
//哪个界面，按什么键，调用什么方法。
export let config: ConfigInfo[] = [
    { name: "NewTest", button: "Button1", function: "onButtonClick", keycode: "D", group: 1 },
    { name: "NewTest", button: "Button2", function: "onButtonClick2", keycode: "S", group: 1 },
    { name: "NewTest", button: "Button3", function: "onButtonClick3", keycode: "BACKSPACE", group: 1 },
    { name: "TestView", button: "Button4", function: "onButtonClick", keycode: "ENTER", group: 2 },
]

export const InputCtrlModeTips = [
    "0 键鼠",
    "1 手柄"
];